'''
Created on 5 Dec 2009

@author: jd437
'''
import single_dose
import GenPrimY
import os
import time
import ArrayParams

GenPrim=GenPrimY.GenPrim
single_dose=single_dose.single_dose

#Here define the primitive structure. choose bt or bar
struc='bt'
length=70
width=70
point=5

#list of lists: each sublist encodes a single field, max 120x120 um
#gaps=[[0,20,30],[50,100]]
gaps=[[0,20,30],[50,100]]
#array densities.
densities=[10000,4000,1500]
#array is size of the array. Number of structures determine such that number*spacing<=array. Currently
#same for sparse and dense arrays.
arraysize=[25000,25000]
#size of gap between arrays of different gap size
arraygap=[10000,10000]

#marker size: x,y,gap from array in x and y dimensions
markersize=[10000,1000,10000]
#size and interparticle spacing of particles making up markers.
markermakeup=[50,100]

#Create the base structure from which the pattern is made
shape=GenPrim(length, width, point,0,0,struc);
#Create an object which holds all of the above parameters for the array
array=ArrayParams.ArrayParams(densities, arraysize, arraygap,markersize, markermakeup, gaps)

    
#set number of doses - identical patterns distinguishable by ticks on their horizontal markers
doses=7

#create a new folder labelled by its creation time to hold generated files
current_time=time.strftime("%d_%m_%y__%H_%M_%S")
os.mkdir(current_time)
os.chdir(current_time)

#generate the files
for i in range(0,doses):
    #this generates the entire pattern. Parameters such as inter structure 
    #spacing are set within single_dose for the antenna, and within
    #GenMarkerTicks for the markers.
    for j in range(0,len(gaps)):
        #x size of array: note that marker[0] is length of marker and marker[2] is marker to array gap
        if(array.fieldspan[0][j]>120000):
            print 'WARNING: Pattern exceeds 120 um in x:'
            print array.fieldspan[0][j]
        if(array.fieldspan[1][j]>120000):
            print 'WARNING: Pattern exceeds 120 um in y:'
            print array.fieldspan[0][j]
        
        single_dose(shape,array,gaps,j,i)


